﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SystemMenu.aspx.cs" Inherits="SystemMenu" %>
<%@ Register Src="UserControls/Nav.ascx" TagName="Nav" TagPrefix="uc"%>
<%@ Register Src="UserControls/Footer.ascx" TagName="Footer" TagPrefix="uc"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="Generator" content="EditPlus" />
	<meta name="Author" content="FanFu" />
	<meta name="Keywords" content="" />
	<meta name="Description" content="" />

	<title>菜单管理</title>
	<link href="css/base.css" rel="stylesheet" type="text/css" />
	<script src="js/jquery-1.6.1.min.js" type="text/javascript"></script>
	<script src="js/effect.js" type="text/javascript"></script>
    <script type="text/javascript">
        function ValidatorInput() {
            if ($.trim($("#txtMenuName").val()) == "") {
                PopupMsg('error', '菜单名称不能为空！');
                $("#txtMenuName").focus();
                return false;
            }
            var isInt = /^[0-9]*[1-9][0-9]*$/;
            if (!isInt.test($("#txtOrd").val())) {
                PopupMsg('error', '菜单排序必须为正整数！');
                $("#txtOrd").focus();
                return false;
            }
            if (parseInt($("#txtOrd").val()) > 9999) {
                PopupMsg('error', '菜单排序数值不能大于9999！');
                $("#txtOrd").focus();
                return false;
            }
            return true;
        }

        function ResetInput() {
            $("#txtMenuName").val("");
            $("#txtMenuUrl").val("");
            $("#txtOrd").val("");
            $("#drpParent option:eq(0)").attr('selected', 'selected');
            $("#chkIsEnd")[0].checked = true;
            $("#chkFlag")[0].checked = true;
        }

        function AddNew() {
            $("#editState").val("false");
            ResetInput();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        
        <uc:Nav ID="Nav1" runat="server"/>

        <!-- main_content begin -->
	    <div id="main_content" class="clearfix">
			
            <!-- search_box begin -->
            <div class="content_box">
                <div class="box_title">
				    <h3 class="subControl">菜单搜索</h3>
                </div>
                <div class="box_content">
                    <div id="searchBox">
                        <label for="searchMenuName">菜单名称：</label>
                        <input id="searchMenuName" class="textbox" type="text" runat="server"/>
                        <label>父级菜单：</label>
                        <asp:DropDownList ID="searchParent" class="drplist" runat="server"></asp:DropDownList>
                        <label>是否末级：</label>
                        <asp:DropDownList ID="searchIsEnd" class="drplist" runat="server"></asp:DropDownList>
                        <label>菜单状态：</label>
                        <asp:DropDownList ID="searchFlag" class="drplist" runat="server"></asp:DropDownList>
                        <asp:Button ID="btnSearch" class="button" runat="server" Text="查询" 
                            onclick="btnSearch_Click" />
                    </div>
                </div>
            <!-- search_box end -->
            </div>
            
		    <!-- content_box begin -->
		    <div class="content_box">
				
			    <div class="box_title">
				    <h3 class="subControl">菜单管理</h3>
				    <ul class="box_title_tabs">
					    <li class="current">列表</li>
					    <li>新建/编辑</li>
				    </ul>
			    </div>

			    <div class="box_content">
					
				    <div id="msgPrompt" class="information" style="display:none;">
					    <img class="infoclose" alt="关闭" src="images/icons/cross_grey_small.gif" />
					    <div>提醒信息！</div>
				    </div>

				    <div id="dataList" class="box_content_tab">
					    <table>
						    <thead>
							    <tr>
								    <th><input id="check_all" type="checkbox" /></th>
								    <th>菜单名称</th>
								    <th>链接地址</th>
								    <th>父级ID</th>
								    <th>父级名称</th>
								    <th>是否末级</th>
                                    <th>菜单排序</th>
                                    <th>菜单状态</th>
                                    <th>用户操作</th>
							    </tr>
						    </thead>

						    <tbody>
                                <asp:Repeater ID="rptDataList" runat="server">
                                    <ItemTemplate>
                                        <tr>
								            <td><input value='<%# Eval("ID") %>' type="checkbox" /></td>
								            <td><%# Eval("MenuName")%></td>
								            <td><%# Eval("MenuUrl")%></td>
								            <td><%# Eval("ParentId")%></td>
                                            <td><%# Eval("ParentName")%></td>
                                            <td><%# Eval("IsEnd").ToString()=="1"?"是":"否"%></td>
                                            <td><%# Eval("Ord")%></td>
                                            <td><%# Eval("Flag").ToString()=="1"?"正常":"删除"%></td>
								            <td>
									            <input title="Edit" class="btnEdit" type="button" onfocus="this.blur()" />
									            <input title="Delete" class="btnDelete" type="button" onfocus="this.blur()" />
								            </td>
							            </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
						    </tbody>

						    <tfoot>
							    <tr>
								    <td colspan="9">
									    <div id="bulk_actions">
                                            <asp:Button ID="btnDelete" class="button" runat="server" Text="批量删除" 
                                                onclick="btnDelete_Click" />
									    </div>
									    <div id="paging" runat="server"></div>
								    </td>
							    </tr>
						    </tfoot>
					    </table>
				    </div>
					
				    <div id="addEdit" class="box_content_tab" style="display:none;">
					    <table>
						    <tbody>
							    <tr>
								    <td width="70"><label for="txtMenuName">菜单名称：</label></td>
								    <td>
                                        <input id="txtMenuName" class="textbox" type="text" runat="server"/>
                                    </td>
							    </tr>
							    <tr>
								    <td><label for="txtMenuUrl">链接地址：</label></td>
								    <td>
									    <input id="txtMenuUrl" class="textbox" type="text" runat="server" />
								    </td>
							    </tr>
                                <tr>
								    <td><label for="txtOrd">菜单排序：</label></td>
								    <td>
									    <input id="txtOrd" class="textbox" type="text" runat="server" />
								    </td>
							    </tr>
                                <tr>
								    <td><label>父级菜单：</label></td>
								    <td>
									   <asp:DropDownList ID="drpParent" class="drplist" runat="server"></asp:DropDownList>
								    </td>
							    </tr>     
                                <tr>
								    <td><label for="chkIsEnd">是否末级：</label></td>
								    <td><input id="chkIsEnd" class="checkbox" type="checkbox" runat="server" /></td>
							    </tr>
                                <tr>
								    <td><label for="chkFlag">是否正常：</label></td>
								    <td><input id="chkFlag" class="checkbox" type="checkbox" runat="server" /></td>
							    </tr>
						    </tbody>
						    <tfoot>
							    <tr>
								    <td>&nbsp;</td>
								    <td>
                                        <input class="button" type="button" onclick="AddNew();" value="新建"/>
                                        <input class="button" type="button" onclick="ResetInput();" value="清空" />
                                        <asp:Button class="button" ID="btnSave" runat="server" OnClientClick="return ValidatorInput();" onclick="btnSave_Click" Text="保存" />
								    </td>
							    </tr>
						    </tfoot>
					    </table>
				    </div> 
			    </div>

            <input id="deleteID" type="hidden" runat="server" />
            <input id="editID" type="hidden" runat="server" />
            <input id="editState" type="hidden" runat="server" />
            <asp:LinkButton ID="lbtnEdit" runat="server" onclick="lbtnEdit_Click"></asp:LinkButton>
		    <!-- content_box end -->
		    </div>

		    <uc:Footer ID="Footer1" runat="server"/>

	    <!-- main_content begin -->
	    </div>
    </form>
</body>
</html>
